<include file="public/header"/>

<div class="am-cf admin-main">
  <!-- sidebar start -->
    <include file="public/sidebar"/>
  <!-- sidebar end -->

  <!-- content start -->
  <div class="admin-content">
    <div class="am-cf am-padding">
            <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">选择时间导出</strong></div>
    </div>
    <hr/>
    <div class="am-g">
      <div class="am-u-sm-12 am-u-md-8 am-u-md-pull-4" style="float: right;">

          <!--返工记录导出-->
          <if condition="$status eq 5">
              <form class="am-form am-form-horizontal" method="post" action="__URL__/returnOrderExport2" name="form2">
                  <div class="am-form-group">
                      <label class="am-u-sm-3 am-form-label">开始日期</label>
                      <div class="am-u-sm-9">
                          <input type="text" name="start_time" data-am-datepicker readonly/>
                      </div>
                  </div>
                  <div class="am-form-group">
                      <label class="am-u-sm-3 am-form-label">结束日期</label>
                      <div class="am-u-sm-9">
                          <input type="text" name="end_time" data-am-datepicker readonly/>
                      </div>
                  </div>
                  <div class="am-form-group">
                      <div class="am-u-sm-9 am-u-sm-push-3">
                          <button type="submit" class="am-btn am-btn-primary">导出</button>
                      </div>
                  </div>
              </form>
              <else/>
              <!--已配送订单导出-->
              <form class="am-form am-form-horizontal" method="post" action="__URL__/endListExport2" name="form2">
                  <div class="am-form-group">
                      <label class="am-u-sm-3 am-form-label">开始日期</label>
                      <div class="am-u-sm-9">
                          <input type="text" name="start_time" data-am-datepicker readonly/>
                      </div>
                  </div>
                  <div class="am-form-group">
                      <label class="am-u-sm-3 am-form-label">结束日期</label>
                      <div class="am-u-sm-9">
                          <input type="text" name="end_time" data-am-datepicker readonly/>
                      </div>
                  </div>
                  <div class="am-form-group">
                      <div class="am-u-sm-9 am-u-sm-push-3">
                          <button type="submit" class="am-btn am-btn-primary">导出</button>
                      </div>
                  </div>
              </form>
              <!--end-->
          </if>
          <!--end-->
      </div>
    </div>
  </div>
  <!-- content end -->
</div>
<script src="__PUBLIC__/assets/js/jquery.min.js"></script>
<script>
    $(function() {
        var startDate = new Date(2014, 11, 20);
        var endDate = new Date(2014, 11, 25);
        var $alert = $('#my-alert');
        $('#my-start').datepicker().
                on('changeDate.datepicker.amui', function(event) {
                    if (event.date.valueOf() > endDate.valueOf()) {
                        $alert.find('p').text('开始日期应小于结束日期！').end().show();
                    } else {
                        $alert.hide();
                        startDate = new Date(event.date);
                        $('#my-startDate').text($('#my-start').data('date'));
                    }
                    $(this).datepicker('close');
                });

        $('#my-end').datepicker().
                on('changeDate.datepicker.amui', function(event) {
                    if (event.date.valueOf() < startDate.valueOf()) {
                        $alert.find('p').text('结束日期应大于开始日期！').end().show();
                    } else {
                        $alert.hide();
                        endDate = new Date(event.date);
                        $('#my-endDate').text($('#my-end').data('date'));
                    }
                    $(this).datepicker('close');
                });
    });
</script>
<include file="public/footer"/>
